﻿using HybridLab.Workflow.Activities;
using HybridLab.Workflow.Activities.UI;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Client;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace HybridLab.TestForm
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			var tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://localhost:8080/tfs/DefaultCollection"));
			var buildServer = tpc.GetService<IBuildServer>();

			// put a name for a project / build def here
			var buildDef = buildServer.GetBuildDefinition("Code11", "TFSTesterPowerTools");

			var wiz = new HybridLabWizardForm(buildDef, new HybridLabWorkflowDetails());
			wiz.Start();

			// make sure that the args get serialized correctly
			var workflowDetails = wiz.WorkflowDetails;
			var nothing = new HybridLabWorkflowDetails();
			if (nothing == workflowDetails)
			{
				MessageBox.Show("Workflow == operator not working");
			}
			else
			{
				wiz = new HybridLabWizardForm(buildDef, workflowDetails);
				wiz.Start();
			}
		}
	}
}
